//
//  LinkdInAlertView.m
//  League
//
//  Created by 崔璨 on 2018/2/9.
//  Copyright © 2018年 ciyuanjuzhen. All rights reserved.
//

#import "LinkdInAlertView.h"
#import "BaseViewController.h"
@implementation LinkdInAlertView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.frame=frame;
        self.backgroundColor = [UIColor blackColor];
        [self setupUI];
    }
    return self;
}

-(void)setupUI
{
    [InternationalControl initUserLanguage];//初始化应用语言
    NSBundle *bundle = [InternationalControl bundle];
    self.passCodeTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/13)];
    self.passCodeTf.center = CGPointMake(self.width/2, self.height/2);
    self.passCodeTf.layer.masksToBounds = YES;
    self.passCodeTf.layer.cornerRadius = 8;
    self.passCodeTf.backgroundColor = [UIColor whiteColor];
    self.passCodeTf.textAlignment = NSTextAlignmentCenter;
//    [self.passCodeTf becomeFirstResponder];
    [self addSubview:self.passCodeTf];
    
    self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width/1.1, self.height/8)];
    self.titleLab.center = CGPointMake(self.width/2, self.passCodeTf.y - self.titleLab.height);
//    self.titleLab.backgroundColor = [UIColor redColor];
    self.titleLab.textColor = [UIColor whiteColor];
    self.titleLab.font=[UIFont fontWithName:kFontName size:self.titleLab.height/4];
    self.titleLab.textAlignment = NSTextAlignmentCenter;
    
    self.titleLab.text = [bundle localizedStringForKey:@"linkdInTitle" value:nil table:@"hello"];
    [self addSubview:self.titleLab];
    
    self.enterBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/13)];
    self.enterBtn.center = CGPointMake(self.width/2, self.passCodeTf.frame.origin.y+self.passCodeTf.height+self.enterBtn.height);
    self.enterBtn.backgroundColor = [UIColor clearColor];
    [self.enterBtn setTitle:[bundle localizedStringForKey:@"over" value:nil table:@"hello"] forState:UIControlStateNormal];
    [self.enterBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.enterBtn addTarget:self action:@selector(overBtn:) forControlEvents:UIControlEventTouchDown];
    self.enterBtn.layer.masksToBounds = YES;
    self.enterBtn.layer.cornerRadius = 8;
    self.enterBtn.layer.borderWidth = 2;
    self.enterBtn.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.enterBtn.titleLabel.font=[UIFont fontWithName:kFontName size:self.enterBtn.height/3.5];
    [self addSubview:self.enterBtn];
    
}
-(void)overBtn:(UIButton *)sender
{
    [self removeFromSuperview];
}
@end
